{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "actual-inclusion",
   "metadata": {},
   "source": [
    "# Installation\n",
    "\n",
    "The package `interpret` is handy for data scientists in the prototyping and model building phase. However the number of dependencies required is exhaustive, and for production environments it's often better to select only the components you need for installation. Sometimes you'll also have a better understanding of what dependency versions can work with `interpret` and your environment, even if we don't officially support it. As such we offer options `interpret` and `interpret-core` for both scenarios."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "drawn-hamburg",
   "metadata": {},
   "source": [
    "## Install with every dependency (default)\n",
    "\n",
    "The package `interpret` installs every dependency needed to run any part of the package.\n",
    "\n",
    "````{tab-set}\n",
    "```{tab-item} pip\n",
    "pip install interpret\n",
    "```\n",
    "```{tab-item} conda\n",
    "conda install -c conda-forge interpret\n",
    "```\n",
    "```{tab-item} source\n",
    "git clone https://github.com/interpretml/interpret.git && cd interpret/scripts && make install\n",
    "```\n",
    "````"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "surprised-driver",
   "metadata": {},
   "source": [
    "## Install with no dependencies \n",
    "\n",
    "When you don't want any dependencies to automatically install and you only need the code, install the package `interpret-core` instead. The package `interpret-core` is a zero-dependency install.\n",
    "\n",
    "````{tab-set}\n",
    "```{tab-item} pip\n",
    "pip install interpret-core\n",
    "```\n",
    "```{tab-item} conda\n",
    "conda install -c conda-forge interpret-core\n",
    "```\n",
    "```{tab-item} source\n",
    "git clone https://github.com/interpretml/interpret.git && cd interpret/scripts && make install-core\n",
    "```\n",
    "````"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "alone-equivalent",
   "metadata": {},
   "source": [
    "## Install with some official dependencies (pip)\n",
    "\n",
    "This scenario is not covered in all package managers we support. If you are installing with `pip`, you can take advantage of extra tags that are exposed for `interpret-core`. It's best to look at the source code to see how this works.\n",
    "\n",
    "- `interpret` utilizing `interpret-core` tags found [here](https://github.com/interpretml/interpret/blob/develop/python/interpret/setup.py).\n",
    "- `interpret-core` extra tags found [here](https://github.com/interpretml/interpret/blob/develop/python/interpret-core/setup.py)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "virgin-shakespeare",
   "metadata": {},
   "source": [
    "# Exposing Visualizations"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "armed-trustee",
   "metadata": {},
   "source": [
    "The visualizations that power `interpret` use different renderers depending on the environment they are in. In most cases, the package will detect what kind of environment it is in and use the appropriat [renderer](https://github.com/interpretml/interpret/blob/683e632f4122af54eada2e214066de7be75bd7e0/python/interpret-core/interpret/provider/visualize.py#L25). There are times though when you want to forcefully select which one."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "impressed-tissue",
   "metadata": {},
   "source": [
    "## Dash Renderer\n",
    "\n",
    "The Dash renderer is used for local environments such as running a Jupyter notebook on your laptop. It runs a Dash server, backed by Apache Flask in a separate process the first time its called by `interpret`.\n",
    "\n",
    "This provides access to both embedded visualizations within notebooks as well as the full dashboard. However, due to requiring a live Flask server, it cannot render in an offline notebook.\n",
    "\n",
    "See the source code for underestandings its configuration [here](https://github.com/interpretml/interpret/blob/683e632f4122af54eada2e214066de7be75bd7e0/python/interpret-core/interpret/provider/visualize.py#L149)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "grand-report",
   "metadata": {},
   "outputs": [],
   "source": [
    "from interpret import set_visualize_provider\n",
    "from interpret.provider import DashProvider\n",
    "set_visualize_provider(DashProvider.from_address(('127.0.0.1', 7001)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "alert-peeing",
   "metadata": {},
   "source": [
    "```{eval-rst}\n",
    ".. autoclass:: interpret.provider.DashProvider\n",
    "   :members:\n",
    "   :inherited-members:\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "adjacent-motorcycle",
   "metadata": {},
   "source": [
    "## Inline Renderer\n",
    "\n",
    "The inline renderer is used for cloud environments access to flask servers are not always available. In most configurations, it injects JavaScript in each notebook cell, including the bundle.\n",
    "\n",
    "This does not allow for full dashboards, but it does allow offline support.\n",
    "\n",
    "See the source code for underestandings its configuration [here](https://github.com/interpretml/interpret/blob/683e632f4122af54eada2e214066de7be75bd7e0/python/interpret-core/interpret/provider/visualize.py#L192)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "assisted-bride",
   "metadata": {},
   "outputs": [],
   "source": [
    "from interpret import set_visualize_provider\n",
    "from interpret.provider import InlineProvider\n",
    "set_visualize_provider(InlineProvider())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "latin-brook",
   "metadata": {},
   "source": [
    "```{eval-rst}\n",
    ".. autoclass:: interpret.provider.InlineProvider\n",
    "   :members:\n",
    "   :inherited-members:\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "shaped-moses",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
